/**
 * Copyright &copy; 2012-2014 <a href="https://github.cn.apestar">JeeSite</a> All rights reserved.
 */
package cn.apestar.modules.sys.entity;

import javax.xml.bind.annotation.XmlAttribute;

import org.hibernate.validator.constraints.Length;

import cn.apestar.common.persistence.DataEntity;

/**
 * 枚举管理Entity
 * @author yudw
 * @version 2016-08-02
 */
public class Dict extends DataEntity<Dict> {

    private static final long serialVersionUID = 1L;

    private String type; // 枚举类型

    private String value; // 枚举类型

    @XmlAttribute
    @Length(min = 1, max = 100, message = "枚举显示长度必须介于 0 和 100 之间")
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    private String code; // 枚举值

    private String label; // 枚举显示

    private String description; // 枚举描述

    private Long sort; // 排序

    private String parentId; // 父节点

    private String path; // 路径

    public Dict() {
        super();
    }

    public Dict(String id) {
        super(id);
    }

    public Dict(String code, String label) {
        this.code = code;
        this.value = code;
        this.label = label;
    }

    public Dict(Integer id, Integer code, String label) {
        this.code = code.toString();
        this.value = this.code.toString();
        this.label = label;
        this.id = id.toString();
    }

    @Length(min = 0, max = 100, message = "枚举类型长度必须介于 0 和 100 之间")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Length(min = 0, max = 100, message = "枚举值长度必须介于 0 和 100 之间")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @XmlAttribute
    @Length(min = 0, max = 100, message = "枚举显示长度必须介于 0 和 100 之间")
    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @XmlAttribute
    @Length(min = 0, max = 255, message = "枚举描述长度必须介于 0 和 255 之间")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getSort() {
        return sort;
    }

    public void setSort(Long sort) {
        this.sort = sort;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    @Length(min = 0, max = 255, message = "路径长度必须介于 0 和 255 之间")
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

}